<?php
class UpfileAction extends CommonAction{
	public function index(){
		$this->display();
	}
	public function upload(){
	
	import("ORG.Net.UploadFile");
	$upload = new UploadFile();// 实例化上传类
	$upload->maxSize  = 3145728 ;// 设置附件上传大小
	$upload->saveRule = time;
	$upload->autoSub=true;
    $upload->subType="date";
    $upload->dateFormat="Ymd";
	$upload->allowExts  = array('jpg', 'gif', 'png', 'jpeg');// 设置附件上传类型
	$upload->savePath =  './Public/Uploads/';// 设置附件上传目录
	
	if(!$upload->upload()) {// 上传错误提示错误信息
	//$this->error($upload->getErrorMsg());
	echo ('{"fileName":""}');
		}else{// 上传成功 获取上传文件信息
	$uploadList =  $upload->getUploadFileInfo();
	//$this->ajaxReturn($info,"新增成功！",1);	
	echo ('{"fileName":"'.$uploadList[0][savename].'"}');

 		}
  	
	}	
}
?>